export default function (meta, vm) {
  return {
    onInit: function () {
      vm.on("addMethodRule", args => {
        let model = vm.getModel("devs-obj-detail_methods");
        let rows = model.exec("selRows");
        debugger;
        if (rows.length == 0) {
          vm.utils.message("请选择要增加规则的方法！");
          return false;
        } else if (rows.length > 1) {
          vm.utils.message("一次只能选择一个方法！");
          return false;
        }
        let data = vm.getData();
        let methodData = rows[0];

        args.data.param = {
          "ns": data.ns,
          "name": data.name,
          "action": methodData.name,
          "sort": 10
        };
        vm.utils.showDialog("devs_obj_dialog_add_rules", args);
        return args.promise;
      });
    }
  }
}